SOAccept


C Specification

#include <dolphin/socket.h>
int SOAccept ( int s, void* sockAddr );

Description

SOAccept() extracts the first connection on the queue of pending connections, creates a new socket with the same socket type, protocol and address family as the specified socket, and returns a new socket descriptor for that socket. The original socket remains open for further connection requests.

SOAccept() blocks if there are no connections pending, unless the socket descriptor is set to the nonblocking mode with SOFcntl().

Arguments

s Specifies a socket that was created with SOSocket(), has been bound to an address with SOBind(), and has issued a successful call to SOListen().
sockAddr Either a null pointer, or a pointer to a socket address structure where the address of the peer for the accepted connection is stored. If specifying a non-null pointer, the len field of the socket address must be properly initialized (e.g., sizeof(SOSockAddrIn)).

Return Values

non-negative Socket descriptor of the accepted socket.
SO_EAGAIN SO_O_NONBLOCK is set for the socket descriptor and no connections are present to be accepted.
SO_EBADF Bad socket descriptor.
SO_ECONNABORTED Connection aborted.
SO_EINVAL Invalid operation.
SO_EMFILE No more socket descriptors.
SO_ENETRESET Socket library is not initialized.
SO_EOPNOTSUPP Non-supported operation.
SO_EWOULDBLOCK Same as SO_EAGAIN.

Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.

See Also

SOFcntl(), SOGetPeerName(), SOListen()